Patch from Felix Bellaby <felix@pooh.u-net.com>
authorOwen Taylor <otaylor@redhat.com>
Sun, 17 Jan 1999 22:58:59 +0000 (22:58 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Sun, 17 Jan 1999 22:58:59 +0000 (22:58 +0000)
Sun Jan 17 17:56:33 1999  Owen Taylor  <otaylor@redhat.com>

Patch from Felix Bellaby <felix@pooh.u-net.com>

* gdk/gdk.c: Use XmbSetWMProperties to set
the class/command on the loader window so that the
client machine is also set in the same place.
(For X11R5 sesssion management compatibility)

* gdk/gdk.c: (gdk_set_sm_client_id) Implementation
of function to set the session manager client ID.

* gdk/gdkwindow.c (gdk_window_new): Set
WM_CLIENT_LEADER propertiy on all windows pointing
back to GDK's leader window.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gdk/gdk.c
gdk/gdkwindow.c
gdk/x11/gdkmain-x11.c
gdk/x11/gdkwindow-x11.c

index 18c3e6bbf44f4864d4aacbb609a66b123f22904c..b0acd2f5774f9abe982dcce111688fa353844ba6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+Sun Jan 17 17:56:33 1999  Owen Taylor  <otaylor@redhat.com>
+
+       Patch from Felix Bellaby <felix@pooh.u-net.com>
+
+       * gdk/gdk.c: Use XmbSetWMProperties to set
+       the class/command on the loader window so that the
+       client machine is also set in the same place.
+       (For X11R5 sesssion management compatibility)
+
+       * gdk/gdk.c: (gdk_set_sm_client_id) Implementation
+       of function to set the session manager client ID.
+
+       * gdk/gdkwindow.c (gdk_window_new): Set 
+       WM_CLIENT_LEADER propertiy on all windows pointing
+       back to GDK's leader window.
+
 Sun Jan 17 12:01:57 1999  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtkrc.c (gtk_rc_style_init): Allow a bg_pixmap
index 18c3e6bbf44f4864d4aacbb609a66b123f22904c..b0acd2f5774f9abe982dcce111688fa353844ba6 100644 (file)
@@ -1,3 +1,19 @@
+Sun Jan 17 17:56:33 1999  Owen Taylor  <otaylor@redhat.com>
+
+       Patch from Felix Bellaby <felix@pooh.u-net.com>
+
+       * gdk/gdk.c: Use XmbSetWMProperties to set
+       the class/command on the loader window so that the
+       client machine is also set in the same place.
+       (For X11R5 sesssion management compatibility)
+
+       * gdk/gdk.c: (gdk_set_sm_client_id) Implementation
+       of function to set the session manager client ID.
+
+       * gdk/gdkwindow.c (gdk_window_new): Set 
+       WM_CLIENT_LEADER propertiy on all windows pointing
+       back to GDK's leader window.
+
 Sun Jan 17 12:01:57 1999  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtkrc.c (gtk_rc_style_init): Allow a bg_pixmap
index 18c3e6bbf44f4864d4aacbb609a66b123f22904c..b0acd2f5774f9abe982dcce111688fa353844ba6 100644 (file)
@@ -1,3 +1,19 @@
+Sun Jan 17 17:56:33 1999  Owen Taylor  <otaylor@redhat.com>
+
+       Patch from Felix Bellaby <felix@pooh.u-net.com>
+
+       * gdk/gdk.c: Use XmbSetWMProperties to set
+       the class/command on the loader window so that the
+       client machine is also set in the same place.
+       (For X11R5 sesssion management compatibility)
+
+       * gdk/gdk.c: (gdk_set_sm_client_id) Implementation
+       of function to set the session manager client ID.
+
+       * gdk/gdkwindow.c (gdk_window_new): Set 
+       WM_CLIENT_LEADER propertiy on all windows pointing
+       back to GDK's leader window.
+
 Sun Jan 17 12:01:57 1999  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtkrc.c (gtk_rc_style_init): Allow a bg_pixmap
index 18c3e6bbf44f4864d4aacbb609a66b123f22904c..b0acd2f5774f9abe982dcce111688fa353844ba6 100644 (file)
@@ -1,3 +1,19 @@
+Sun Jan 17 17:56:33 1999  Owen Taylor  <otaylor@redhat.com>
+
+       Patch from Felix Bellaby <felix@pooh.u-net.com>
+
+       * gdk/gdk.c: Use XmbSetWMProperties to set
+       the class/command on the loader window so that the
+       client machine is also set in the same place.
+       (For X11R5 sesssion management compatibility)
+
+       * gdk/gdk.c: (gdk_set_sm_client_id) Implementation
+       of function to set the session manager client ID.
+
+       * gdk/gdkwindow.c (gdk_window_new): Set 
+       WM_CLIENT_LEADER propertiy on all windows pointing
+       back to GDK's leader window.
+
 Sun Jan 17 12:01:57 1999  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtkrc.c (gtk_rc_style_init): Allow a bg_pixmap
index 18c3e6bbf44f4864d4aacbb609a66b123f22904c..b0acd2f5774f9abe982dcce111688fa353844ba6 100644 (file)
@@ -1,3 +1,19 @@
+Sun Jan 17 17:56:33 1999  Owen Taylor  <otaylor@redhat.com>
+
+       Patch from Felix Bellaby <felix@pooh.u-net.com>
+
+       * gdk/gdk.c: Use XmbSetWMProperties to set
+       the class/command on the loader window so that the
+       client machine is also set in the same place.
+       (For X11R5 sesssion management compatibility)
+
+       * gdk/gdk.c: (gdk_set_sm_client_id) Implementation
+       of function to set the session manager client ID.
+
+       * gdk/gdkwindow.c (gdk_window_new): Set 
+       WM_CLIENT_LEADER propertiy on all windows pointing
+       back to GDK's leader window.
+
 Sun Jan 17 12:01:57 1999  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtkrc.c (gtk_rc_style_init): Allow a bg_pixmap
index 18c3e6bbf44f4864d4aacbb609a66b123f22904c..b0acd2f5774f9abe982dcce111688fa353844ba6 100644 (file)
@@ -1,3 +1,19 @@
+Sun Jan 17 17:56:33 1999  Owen Taylor  <otaylor@redhat.com>
+
+       Patch from Felix Bellaby <felix@pooh.u-net.com>
+
+       * gdk/gdk.c: Use XmbSetWMProperties to set
+       the class/command on the loader window so that the
+       client machine is also set in the same place.
+       (For X11R5 sesssion management compatibility)
+
+       * gdk/gdk.c: (gdk_set_sm_client_id) Implementation
+       of function to set the session manager client ID.
+
+       * gdk/gdkwindow.c (gdk_window_new): Set 
+       WM_CLIENT_LEADER propertiy on all windows pointing
+       back to GDK's leader window.
+
 Sun Jan 17 12:01:57 1999  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtkrc.c (gtk_rc_style_init): Allow a bg_pixmap
index 18c3e6bbf44f4864d4aacbb609a66b123f22904c..b0acd2f5774f9abe982dcce111688fa353844ba6 100644 (file)
@@ -1,3 +1,19 @@
+Sun Jan 17 17:56:33 1999  Owen Taylor  <otaylor@redhat.com>
+
+       Patch from Felix Bellaby <felix@pooh.u-net.com>
+
+       * gdk/gdk.c: Use XmbSetWMProperties to set
+       the class/command on the loader window so that the
+       client machine is also set in the same place.
+       (For X11R5 sesssion management compatibility)
+
+       * gdk/gdk.c: (gdk_set_sm_client_id) Implementation
+       of function to set the session manager client ID.
+
+       * gdk/gdkwindow.c (gdk_window_new): Set 
+       WM_CLIENT_LEADER propertiy on all windows pointing
+       back to GDK's leader window.
+
 Sun Jan 17 12:01:57 1999  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtkrc.c (gtk_rc_style_init): Allow a bg_pixmap
index da1a29b7899a921fe9d1633109af098e42e3a64f..ea2a65aa24ead811f9d5347044e1c262d76691c4 100644 (file)
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -382,8 +382,9 @@ gdk_init (int        *argc,
       gdk_progclass[0] = toupper (gdk_progclass[0]);
     }
   class_hint->res_class = gdk_progclass;
-  XSetClassHint(gdk_display, gdk_leader_window, class_hint);
-  XSetCommand(gdk_display, gdk_leader_window, argv_orig, argc_orig);
+  XmbSetWMProperties (gdk_display, gdk_leader_window,
+                      NULL, NULL, argv_orig, argc_orig, 
+                      NULL, NULL, class_hint);
   XFree (class_hint);
   
   for (i = 0; i < argc_orig; i++)
@@ -873,6 +874,43 @@ gdk_screen_height_mm (void)
   return return_val;
 }
 
+/*
+ *--------------------------------------------------------------
+ * gdk_set_sm_client_id
+ *
+ *   Set the SM_CLIENT_ID property on the WM_CLIENT_LEADER window
+ *   so that the window manager can save our state using the
+ *   X11R6 ICCCM session management protocol. A NULL value should 
+ *   be set following disconnection from the session manager to
+ *   remove the SM_CLIENT_ID property.
+ *
+ * Arguments:
+ * 
+ *   "sm_client_id" specifies the client id assigned to us by the
+ *   session manager or NULL to remove the property.
+ *
+ * Results:
+ *
+ * Side effects:
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+gdk_set_sm_client_id (const gchar* sm_client_id)
+{
+  if (sm_client_id && strcmp (sm_client_id, ""))
+    {
+      XChangeProperty (gdk_display, gdk_leader_window,
+                      gdk_atom_intern ("SM_CLIENT_ID", FALSE),
+                      XA_STRING, 8, PropModeReplace,
+                      sm_client_id, strlen(sm_client_id));
+    }
+  else
+     XDeleteProperty (gdk_display, gdk_leader_window,
+                     gdk_atom_intern ("SM_CLIENT_ID", FALSE));
+}
+
 void
 gdk_key_repeat_disable (void)
 {
index c0f34c12e4bbfc68722fc02e11f9618a38e603ae..d9c8f3eb0b4dc30a39d4ceba5043f469ceac062b 100644 (file)
@@ -233,6 +233,8 @@ gdk_window_init (void)
   gdk_xid_table_insert (&gdk_root_window, &gdk_root_parent);
 }
 
+static GdkAtom wm_client_leader_atom = GDK_NONE;
+
 GdkWindow*
 gdk_window_new (GdkWindow     *parent,
                GdkWindowAttr *attributes,
@@ -447,6 +449,14 @@ gdk_window_new (GdkWindow     *parent,
 
   XSetWMHints (private->xdisplay, private->xwindow, &wm_hints);
 
+  if (!wm_client_leader_atom)
+     wm_client_leader_atom = gdk_atom_intern ("WM_CLIENT_LEADER", FALSE);
+
+  XChangeProperty (private->xdisplay, private->xwindow,
+                  wm_client_leader_atom,
+                  XA_WINDOW, 32, PropModeReplace,
+                  (guchar*) &gdk_leader_window, 1);
+
   if (attributes_mask & GDK_WA_TITLE)
     title = attributes->title;
   else
index da1a29b7899a921fe9d1633109af098e42e3a64f..ea2a65aa24ead811f9d5347044e1c262d76691c4 100644 (file)
@@ -382,8 +382,9 @@ gdk_init (int        *argc,
       gdk_progclass[0] = toupper (gdk_progclass[0]);
     }
   class_hint->res_class = gdk_progclass;
-  XSetClassHint(gdk_display, gdk_leader_window, class_hint);
-  XSetCommand(gdk_display, gdk_leader_window, argv_orig, argc_orig);
+  XmbSetWMProperties (gdk_display, gdk_leader_window,
+                      NULL, NULL, argv_orig, argc_orig, 
+                      NULL, NULL, class_hint);
   XFree (class_hint);
   
   for (i = 0; i < argc_orig; i++)
@@ -873,6 +874,43 @@ gdk_screen_height_mm (void)
   return return_val;
 }
 
+/*
+ *--------------------------------------------------------------
+ * gdk_set_sm_client_id
+ *
+ *   Set the SM_CLIENT_ID property on the WM_CLIENT_LEADER window
+ *   so that the window manager can save our state using the
+ *   X11R6 ICCCM session management protocol. A NULL value should 
+ *   be set following disconnection from the session manager to
+ *   remove the SM_CLIENT_ID property.
+ *
+ * Arguments:
+ * 
+ *   "sm_client_id" specifies the client id assigned to us by the
+ *   session manager or NULL to remove the property.
+ *
+ * Results:
+ *
+ * Side effects:
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+gdk_set_sm_client_id (const gchar* sm_client_id)
+{
+  if (sm_client_id && strcmp (sm_client_id, ""))
+    {
+      XChangeProperty (gdk_display, gdk_leader_window,
+                      gdk_atom_intern ("SM_CLIENT_ID", FALSE),
+                      XA_STRING, 8, PropModeReplace,
+                      sm_client_id, strlen(sm_client_id));
+    }
+  else
+     XDeleteProperty (gdk_display, gdk_leader_window,
+                     gdk_atom_intern ("SM_CLIENT_ID", FALSE));
+}
+
 void
 gdk_key_repeat_disable (void)
 {
index c0f34c12e4bbfc68722fc02e11f9618a38e603ae..d9c8f3eb0b4dc30a39d4ceba5043f469ceac062b 100644 (file)
@@ -233,6 +233,8 @@ gdk_window_init (void)
   gdk_xid_table_insert (&gdk_root_window, &gdk_root_parent);
 }
 
+static GdkAtom wm_client_leader_atom = GDK_NONE;
+
 GdkWindow*
 gdk_window_new (GdkWindow     *parent,
                GdkWindowAttr *attributes,
@@ -447,6 +449,14 @@ gdk_window_new (GdkWindow     *parent,
 
   XSetWMHints (private->xdisplay, private->xwindow, &wm_hints);
 
+  if (!wm_client_leader_atom)
+     wm_client_leader_atom = gdk_atom_intern ("WM_CLIENT_LEADER", FALSE);
+
+  XChangeProperty (private->xdisplay, private->xwindow,
+                  wm_client_leader_atom,
+                  XA_WINDOW, 32, PropModeReplace,
+                  (guchar*) &gdk_leader_window, 1);
+
   if (attributes_mask & GDK_WA_TITLE)
     title = attributes->title;
   else